 
select a.vip_no into #a from pos_vip_info a
where exists (select * from pos_sales_hdr aa where a.vip_no = aa.vip_no and a.shop_code in ('HKLCX     ','HKLP      '))
 
 select a.vip_no into #b from pos_vip_info a
where exists (select * from pos_sales_hdr aa where a.vip_no = aa.vip_no and a.shop_code in ('hkml'))
  select cur_vip_pts, * from #a a join pos_vip_info b on a.vip_no = b.vip_no and b.cur_vip_pts <> 0
  select * from #b

 begin tran

 declare @i int 
select @i = convert(int, var_data) 
from igs_parm with(updlock) where var_name = 'gv_upd_id'

update pos_vip_info set vip_type = '1218-VIP'  from #a a where pos_vip_info.vip_no = a.vip_no
update pos_vip_info set vip_type = 'ML-VIP'  from #b a where pos_vip_info.vip_no = a.vip_no

 rollback tran
 select * from pos_vip_type